import wiringpi
import time

LED_PIN = 2  # wPi 编号 2（对应物理引脚 7，GPIO 73）

wiringpi.wiringPiSetup()  # 初始化 wiringPi
wiringpi.pinMode(LED_PIN, wiringpi.OUTPUT)  # 设置为输出

try:
    while True:
        wiringpi.digitalWrite(LED_PIN, wiringpi.HIGH)  # 点亮
        print("LED ON")
        time.sleep(1)

        wiringpi.digitalWrite(LED_PIN, wiringpi.LOW)   # 熄灭
        print("LED OFF")
        time.sleep(1)
except KeyboardInterrupt:
    wiringpi.digitalWrite(LED_PIN, wiringpi.LOW)  # 确保 LED 关闭
    print("\n程序结束")